{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "import keras\n",
    "from keras.datasets import cifar10\n",
    "from keras.preprocessing.image import ImageDataGenerator\n",
    "from keras.models import Sequential\n",
    "from keras.layers import Dense, Dropout, Activation, Flatten\n",
    "from keras.layers import Conv2D, MaxPooling2D\n",
    "\n",
    "import numpy as np\n",
    "import os\n",
    "import wandb\n",
    "from wandb.keras import WandbCallback\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W&B Run: https://app.wandb.ai/l2k2/cifar/runs/swfj8tg9\n",
      "Call `%%wandb` in the cell containing your training loop to display live results.\n"
     ]
    }
   ],
   "source": [
    "wandb.init(project=\"cifar\")\n",
    "config = wandb.config\n",
    "config.dropout = 0.25\n",
    "config.dense_layer_nodes = 100\n",
    "config.learn_rate = 0.08\n",
    "config.batch_size = 256\n",
    "config.epochs = 50\n",
    "\n",
    "class_names = ['airplane','automobile','bird','cat','deer',\n",
    "               'dog','frog','horse','ship','truck']\n",
    "num_classes = len(class_names)\n",
    "\n",
    "(X_train, y_train), (X_test, y_test) = cifar10.load_data()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f18f49893c8>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAHXBJREFUeJztnW+MXOd13p9z7/yf3eWSI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Feh8rjmBZCBY6wIOqryTbjfVjAnJiZYVoD8nl3//RNQwudExbHoudkYUVzF7WCectq5nswXUn9ewD/5ohi+EVMlYbvAfjBIuMA8CVM/3wcYfrZ7cOY9jx8AsCPAPwvACeOKI7/AuD7AJ7FNPnOLCCOd2H6J/2zAJ6Z/XvPouckiGOhcwLgn2FaFPdZTN9o/u1N1+xfA/gxgP8GoHmQ8+gbfkJkSu4LfkJki5JfiExR8guRKUp+ITJFyS9Epij5hcgUJb8QmaLkFyJT/i+HmTDK4oRmrgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(X_train[10])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Convert class vectors to binary class matrices.\n",
    "y_train = keras.utils.to_categorical(y_train, num_classes)\n",
    "y_test = keras.utils.to_categorical(y_test, num_classes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train = X_train.astype('float32') / 255.\n",
    "X_test = X_test.astype('float32') / 255."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = Sequential()\n",
    "model.add(Conv2D(32, (3, 3), padding='same',\n",
    "                 input_shape=X_train.shape[1:], activation='relu'))\n",
    "model.add(MaxPooling2D(pool_size=(2, 2)))\n",
    "model.add(Dropout(config.dropout))\n",
    "\n",
    "model.add(Flatten())\n",
    "model.add(Dense(config.dense_layer_nodes, activation='relu'))\n",
    "model.add(Dropout(config.dropout))\n",
    "model.add(Dense(num_classes, activation='softmax'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [],
   "source": [
    "model.compile(loss='categorical_crossentropy',\n",
    "              optimizer=\"adam\",\n",
    "              metrics=['accuracy'])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W&B Run: https://app.wandb.ai/l2k2/cifar/runs/1iangnps\n",
      "Call `%%wandb` in the cell containing your training loop to display live results.\n",
      "Train on 50000 samples, validate on 10000 samples\n",
      "Epoch 1/10\n",
      "41984/50000 [========================>.....] - ETA: 0s - loss: 14.5041 - acc: 0.1001"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-58-4fa842e9ddb1>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      3\u001b[0m                         \u001b[0mepochs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m                         \u001b[0mvalidation_data\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX_test\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my_test\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m                         \u001b[0mcallbacks\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mWandbCallback\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      6\u001b[0m )\n",
      "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/keras/engine/training.py\u001b[0m in \u001b[0;36mfit\u001b[0;34m(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, **kwargs)\u001b[0m\n\u001b[1;32m   1037\u001b[0m                                         \u001b[0minitial_epoch\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minitial_epoch\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1038\u001b[0m                                         \u001b[0msteps_per_epoch\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msteps_per_epoch\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1039\u001b[0;31m                                         validation_steps=validation_steps)\n\u001b[0m\u001b[1;32m   1040\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1041\u001b[0m     def evaluate(self, x=None, y=None,\n",
      "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/keras/engine/training_arrays.py\u001b[0m in \u001b[0;36mfit_loop\u001b[0;34m(model, f, ins, out_labels, batch_size, epochs, verbose, callbacks, val_f, val_ins, shuffle, callback_metrics, initial_epoch, steps_per_epoch, validation_steps)\u001b[0m\n\u001b[1;32m    197\u001b[0m                     \u001b[0mins_batch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mins_batch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoarray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    198\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 199\u001b[0;31m                 \u001b[0mouts\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mins_batch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    200\u001b[0m                 \u001b[0mouts\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mto_list\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mouts\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    201\u001b[0m                 \u001b[0;32mfor\u001b[0m \u001b[0ml\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mo\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mzip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mout_labels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mouts\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m   2713\u001b[0m                 \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_legacy_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2714\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2715\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2716\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2717\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mpy_any\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mis_tensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py\u001b[0m in \u001b[0;36m_call\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m   2673\u001b[0m             \u001b[0mfetched\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_callable_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0marray_vals\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_metadata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2674\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2675\u001b[0;31m             \u001b[0mfetched\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_callable_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0marray_vals\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2676\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mfetched\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2677\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m   1397\u001b[0m           ret = tf_session.TF_SessionRunCallable(\n\u001b[1;32m   1398\u001b[0m               \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_handle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatus\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1399\u001b[0;31m               run_metadata_ptr)\n\u001b[0m\u001b[1;32m   1400\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1401\u001b[0m           \u001b[0mproto_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "wandb.init()\n",
    "model.fit(X_train,y_train,batch_size=config.batch_size,\n",
    "                        epochs=10,\n",
    "                        validation_data=(X_test, y_test),\n",
    "                        callbacks=[WandbCallback()]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "datagen = ImageDataGenerator()\n",
    "datagen.fit(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W&B Run: https://app.wandb.ai/l2k2/cifar/runs/ttmv2et0\n",
      "Call `%%wandb` in the cell containing your training loop to display live results.\n",
      "Epoch 1/50\n",
      "195/195 [==============================] - 4s 22ms/step - loss: 1.7466 - acc: 0.3694 - val_loss: 1.4266 - val_acc: 0.5002\n",
      "Epoch 2/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 1.4290 - acc: 0.4907 - val_loss: 1.2862 - val_acc: 0.5508\n",
      "Epoch 3/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 1.3255 - acc: 0.5274 - val_loss: 1.2441 - val_acc: 0.5552\n",
      "Epoch 4/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 1.2632 - acc: 0.5495 - val_loss: 1.1661 - val_acc: 0.5911\n",
      "Epoch 5/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 1.2098 - acc: 0.5684 - val_loss: 1.1425 - val_acc: 0.5955\n",
      "Epoch 6/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 1.1777 - acc: 0.5800 - val_loss: 1.1234 - val_acc: 0.6016\n",
      "Epoch 7/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 1.1357 - acc: 0.5948 - val_loss: 1.1244 - val_acc: 0.6012\n",
      "Epoch 8/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 1.1116 - acc: 0.6030 - val_loss: 1.0755 - val_acc: 0.6265\n",
      "Epoch 9/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 1.0836 - acc: 0.6140 - val_loss: 1.0408 - val_acc: 0.6315\n",
      "Epoch 10/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 1.0663 - acc: 0.6224 - val_loss: 1.0404 - val_acc: 0.6367\n",
      "Epoch 11/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 1.0481 - acc: 0.6263 - val_loss: 1.0312 - val_acc: 0.6403\n",
      "Epoch 12/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 1.0154 - acc: 0.6388 - val_loss: 1.0163 - val_acc: 0.6375\n",
      "Epoch 13/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.9962 - acc: 0.6449 - val_loss: 1.0065 - val_acc: 0.6457\n",
      "Epoch 14/50\n",
      "195/195 [==============================] - 4s 18ms/step - loss: 0.9798 - acc: 0.6500 - val_loss: 1.0053 - val_acc: 0.6460\n",
      "Epoch 15/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 0.9743 - acc: 0.6540 - val_loss: 0.9830 - val_acc: 0.6546\n",
      "Epoch 16/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 0.9507 - acc: 0.6588 - val_loss: 1.0070 - val_acc: 0.6395\n",
      "Epoch 17/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 0.9458 - acc: 0.6613 - val_loss: 0.9766 - val_acc: 0.6567\n",
      "Epoch 18/50\n",
      "195/195 [==============================] - 4s 18ms/step - loss: 0.9214 - acc: 0.6697 - val_loss: 0.9626 - val_acc: 0.6630\n",
      "Epoch 19/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 0.9122 - acc: 0.6772 - val_loss: 0.9596 - val_acc: 0.6625\n",
      "Epoch 20/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.9073 - acc: 0.6739 - val_loss: 0.9812 - val_acc: 0.6543\n",
      "Epoch 21/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.8874 - acc: 0.6823 - val_loss: 0.9688 - val_acc: 0.6629\n",
      "Epoch 22/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.8755 - acc: 0.6893 - val_loss: 0.9704 - val_acc: 0.6570\n",
      "Epoch 23/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 0.8568 - acc: 0.6952 - val_loss: 0.9970 - val_acc: 0.6525\n",
      "Epoch 24/50\n",
      "195/195 [==============================] - 3s 18ms/step - loss: 0.8484 - acc: 0.6968 - val_loss: 0.9792 - val_acc: 0.6565\n",
      "Epoch 25/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.8400 - acc: 0.7015 - val_loss: 0.9684 - val_acc: 0.6647\n",
      "Epoch 26/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.8340 - acc: 0.7016 - val_loss: 0.9556 - val_acc: 0.6619\n",
      "Epoch 27/50\n",
      "195/195 [==============================] - 3s 16ms/step - loss: 0.8222 - acc: 0.7035 - val_loss: 0.9479 - val_acc: 0.6706\n",
      "Epoch 28/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.8132 - acc: 0.7087 - val_loss: 0.9512 - val_acc: 0.6710\n",
      "Epoch 29/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.8041 - acc: 0.7099 - val_loss: 0.9546 - val_acc: 0.6711\n",
      "Epoch 30/50\n",
      "195/195 [==============================] - 3s 16ms/step - loss: 0.7969 - acc: 0.7142 - val_loss: 0.9447 - val_acc: 0.6724\n",
      "Epoch 31/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7842 - acc: 0.7170 - val_loss: 1.0046 - val_acc: 0.6560\n",
      "Epoch 32/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7933 - acc: 0.7160 - val_loss: 0.9762 - val_acc: 0.6594\n",
      "Epoch 33/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7717 - acc: 0.7225 - val_loss: 0.9661 - val_acc: 0.6697\n",
      "Epoch 34/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7638 - acc: 0.7248 - val_loss: 0.9567 - val_acc: 0.6737\n",
      "Epoch 35/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7560 - acc: 0.7234 - val_loss: 0.9898 - val_acc: 0.6602\n",
      "Epoch 36/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7489 - acc: 0.7293 - val_loss: 0.9654 - val_acc: 0.6684\n",
      "Epoch 37/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7462 - acc: 0.7285 - val_loss: 0.9508 - val_acc: 0.6713\n",
      "Epoch 38/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7364 - acc: 0.7324 - val_loss: 0.9599 - val_acc: 0.6682\n",
      "Epoch 39/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7245 - acc: 0.7385 - val_loss: 0.9781 - val_acc: 0.6616\n",
      "Epoch 40/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7239 - acc: 0.7361 - val_loss: 0.9493 - val_acc: 0.6766\n",
      "Epoch 41/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7065 - acc: 0.7435 - val_loss: 0.9581 - val_acc: 0.6720\n",
      "Epoch 42/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7043 - acc: 0.7448 - val_loss: 0.9820 - val_acc: 0.6713\n",
      "Epoch 43/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7043 - acc: 0.7426 - val_loss: 0.9995 - val_acc: 0.6645\n",
      "Epoch 44/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.7063 - acc: 0.7418 - val_loss: 0.9682 - val_acc: 0.6693\n",
      "Epoch 45/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.6937 - acc: 0.7451 - val_loss: 1.0024 - val_acc: 0.6666\n",
      "Epoch 46/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.6950 - acc: 0.7441 - val_loss: 0.9858 - val_acc: 0.6715\n",
      "Epoch 47/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.6841 - acc: 0.7514 - val_loss: 0.9757 - val_acc: 0.6730\n",
      "Epoch 48/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.6798 - acc: 0.7506 - val_loss: 0.9863 - val_acc: 0.6691\n",
      "Epoch 49/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.6793 - acc: 0.7521 - val_loss: 0.9945 - val_acc: 0.6681\n",
      "Epoch 50/50\n",
      "195/195 [==============================] - 3s 17ms/step - loss: 0.6705 - acc: 0.7561 - val_loss: 0.9881 - val_acc: 0.6748\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x7f186557fc50>"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wandb.init()\n",
    "model.fit_generator(datagen.flow(X_train, y_train, batch_size=config.batch_size),\n",
    "                        steps_per_epoch=X_train.shape[0] // config.batch_size,\n",
    "                        epochs=config.epochs,\n",
    "                        validation_data=(X_test, y_test),\n",
    "                        callbacks=[WandbCallback()]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        ...,\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.]],\n",
       "\n",
       "       [[1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        ...,\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [0., 1., 0., ..., 0., 0., 0.]],\n",
       "\n",
       "       [[1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        ...,\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [0., 1., 0., ..., 0., 0., 0.]],\n",
       "\n",
       "       ...,\n",
       "\n",
       "       [[1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        ...,\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [0., 1., 0., ..., 0., 0., 0.]],\n",
       "\n",
       "       [[1., 0., 0., ..., 0., 0., 0.],\n",
       "        [0., 1., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        ...,\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.]],\n",
       "\n",
       "       [[1., 0., 0., ..., 0., 0., 0.],\n",
       "        [0., 1., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        ...,\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.],\n",
       "        [1., 0., 0., ..., 0., 0., 0.]]], dtype=float32)"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "'method' object is not subscriptable",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-42-8088862005ba>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0me\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m: 'method' object is not subscriptable"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
